<?php
namespace app\api\validate;
use think\Validate;

class Goods extends Validate{
	protected $regex = ['price'   => '/\d*\.{0,1}\d{0,2}$/'];
	public $message=[
    	'id.require'=>'传参Id不能为空',
    	'card.require'=>'请输入身份证号',
    	'code.require'=>'请上传验证码',
    	'code.length'=>'验证码长度不正确',
    	'addr.require'=>'请选择收货地址',
    	'goods_id.require'=>'请上传商品Id',
    	'goods_details_id.require'=>'请选择sku',
    	'goods_price.require'=>'请上传商品单价',
    	'goods_price.price'=>'单价格式不正确，最多保留两位小数',
    	'number.require'=>'请上传商品购买数量',
    	'total_money.require'=>'请上传总金额',
    	'total_money.price'=>'总金额格式不正确,请最多保留两位小数',
    	'remark.require'=>'请选择退货原因',
    	'images.require'=>'请上传图片',
    	'refund_num.require'=>'请输入退货数量',
    	'order_details_id.require'=>'请上传订单商品详情id',
    	'courier_sn.require'=>'请填写运单号',
    	'company_id.require'=>'请选择快递公司',
    ];
    
   	public $rule=[
	   	'id'=>'require',
	   	'card'=>'require',
	   	'addr'=>'require',
	   	'goods_id'=>'require',
	   	'goods_details_id'=>'require',
	   	'goods_price'=>'require|regex:price',
	   	'order_details_id'=>'require',
	   	'company_id'=>'require',
	   	'courier_sn'=>'require'
   	];
   	
    public $scene=[
    	'findGoodsDetails'=>['id'],
    	'createGoodsOrder'=>['addr_id'],
    	'createGoodsOrder_data'=>['goods_id','goods_details_id','goods_price','number'],
    	'refund'=>['id','remark','images'],
    	'refund_data'=>['order_details_id','refund_num'],
    	'writeRefundCourierData'=>['id','courier_sn','company_id']
    ]; 
    
}
?>